package com.gitee.wsl.collections.deque

import kotlin.collections.ArrayDeque as KArrayDeque


class ArrayDeque<E>(private val base:KArrayDeque<E> = KArrayDeque()): Deque<E> , MutableCollection<E> by base {
    override fun addFirst(e: E) = base.addFirst(e)

    override fun addLast(e: E) = base.addLast(e)

    override fun offerFirst(e: E): Boolean {
        TODO("Not yet implemented")
    }

    override fun offerLast(e: E): Boolean {
        TODO("Not yet implemented")
    }

    override fun removeFirst() = base.removeFirst()

    override fun removeLast()  = base.removeLast()

    override fun pollFirst(): E? {
        TODO("Not yet implemented")
    }

    override fun pollLast(): E? {
        TODO("Not yet implemented")
    }

    override fun getFirst() = base.first()

    override fun getLast()  = base.last()

    override fun peekFirst(): E? {
        TODO("Not yet implemented")
    }

    override fun peekLast(): E? {
        TODO("Not yet implemented")
    }

    override fun removeFirstOccurrence(o: E): Boolean {
        TODO("Not yet implemented")
    }

    override fun removeLastOccurrence(o: E): Boolean {
        TODO("Not yet implemented")
    }

    override fun push(e: E) {
        TODO("Not yet implemented")
    }

    override fun pop(): E? {
        TODO("Not yet implemented")
    }

    override fun descendingIterator(): MutableIterator<E> {
        TODO("Not yet implemented")
    }

    override fun pollOrNull(): E? {
        TODO("Not yet implemented")
    }

    override fun peekOrNull(): E? {
        TODO("Not yet implemented")
    }

    override fun addAll(elements: Collection<E>): Boolean {
        return base.addAll(elements)
    }

    override fun containsAll(elements: Collection<E>): Boolean {
        return base.containsAll(elements)
    }

    override fun removeAll(elements: Collection<E>): Boolean {
        return base.removeAll(elements)
    }

    override fun retainAll(elements: Collection<E>): Boolean {
        return base.retainAll(elements)
    }
}

fun <E> Deque.Companion.newArrayDeque(initialCapacity: Int): ArrayDeque<E> {
    return ArrayDeque(KArrayDeque(initialCapacity))
}

fun <E> Deque.Companion.newArrayDeque(): ArrayDeque<E> {
    return ArrayDeque(KArrayDeque())
}
